PHP regex delimiters, / vs. | vs. {} , what are the differences?

Posted by powerboy on Stack Overflow See other posts from Stack Overflow or by powerboy
Published on 2010-05-23T17:44:59Z Indexed on 2010/05/23 17:50 UTC
Read the original article Hit count: 249

Filed under:
|

In the PHP manual of PCRE, http://us.php.net/manual/en/pcre.examples.php, it gives 4 examples of valid patterns:

  • /<\/\w+>/
  • |(\d{3})-\d+|Sm
  • /^(?i)php[34]/
  • {^\s+(\s+)?$}

Seems that / , | or a pair of curly braces can use as delimiters, so is there any difference between them?

© Stack Overflow or respective owner

Related posts about php

Related posts about regex